import { useState, useCallback } from "react";

const arr = new Set();

const Chapter16 = (props) => {
    const { title } = props;
    const [keyword, setKeyWord] = useState("");
    const handleChange = useCallback((e) => {
        if (e.target.value) {
            setKeyWord(e.target.value);
        }
    }, []);
    arr.add(handleChange);
    console.log(arr.size);
    return (
        <div className="wrapper wrapper5">
            <div className="page-header">
                <h3>{title}</h3>
            </div>
            <div className="page-content">
                <input
                    type="text"
                    className="form-control"
                    onChange={handleChange}
                    placeholder="请输入搜素关键字"
                />
                <div className="alert alert-danger" style={{ marginTop: 10 }}>
                    当前搜索关键字为：{keyword}
                </div>
            </div>
        </div>
    );
};

export default Chapter16;
